-
Notifications
You must be signed in to change notification settings - Fork 0
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
shuffleanswers
aus Quiz-Einstellungen berücksichtigen
#103
base: dev
Are you sure you want to change the base?
Conversation
b9b210a
to
61e73df
Compare
59b0e5e
to
7f1e1eb
Compare
- possibility to set allowshuffle in the admin settings - overwrite allowshuffle with the quiz setting
7f1e1eb
to
a33b3c8
Compare
@@ -92,6 +94,7 @@ public function start_attempt(question_attempt_step $step, $variant): void { | |||
$this->scoringstate = null; | |||
|
|||
$this->ui = new question_ui_renderer($attempt->ui->content, $attempt->ui->placeholders); | |||
$this->ui->shuffleanswers = $this->shuffleanswers; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Bitte im Konstruktor übergeben.
|
||
// Check if we are in a quiz context. | ||
if ($this->page->context->contextlevel == CONTEXT_MODULE && $this->page->cm->modname == 'quiz') { | ||
$quiz = $DB->get_record('quiz', ['id' => $this->page->cm->instance]); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Die Information steckt doch bereits in $question->shuffleanswers
!?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Wird das $question->shuffleanswers
denn automatisch überschrieben, wenn man in den Quiz Settings > Question Behaviour > Shuffle within questions ändert?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Wenn ich mir https://github.com/moodle/moodle/blob/main/question/engine/bank.php#L278 ansehe, dann scheint das ja gemacht zu werden. Da der Wert aber nur im Falle von "kein shuffle" gesetzt/überschrieben wird, müsstest du vermutlich vorher mittels isset prüfen, ob das Attribut überhaupt existiert.
// Whether the content of a qpy:shuffle-contents can be randomly shuffled. | ||
$mform->addElement('hidden', 'shuffleanswers', get_config('qtype_questionpy', 'shuffleanswers')); | ||
$mform->setType('shuffleanswers', PARAM_BOOL); | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Bitte keine neuen Einstellungen einführen. Ob so eine Einstellung für das jeweilige Paket sinnvoll ist, müssen die Pakete selber wissen und in ihren Options definieren.
*/ | ||
protected function initialise_question_instance(question_definition $question, $questiondata) { | ||
parent::initialise_question_instance($question, $questiondata); | ||
$question->shuffleanswers = $questiondata->shuffleanswers; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Greifst du hier auf das richtige Attribut zu? Moodle schreibt ja in $questiondata->options->shuffleanswers
.
Also das Moodle-Feature riecht für mich ganz stark nach einem schlecht durchdachten Nebengedanken. Datenbankzugriff oder Schema-Änderungen sind dann gar nicht notwendig, auch keine Änderungen an der options form. |
Ich hab das so ähnlich umgesetzt wie bei dem Multichoice Fragetypen. D.h. die
shuffleanswers
Flag wird in den Admin settings gesetzt und über die edit form in der Datenbank gespeichert.Ich dachte, wenn ich mir schon Gedanken zu dem Thema mache, hat man später die Möglichkeit hier global diese Option zu setzen oder eventuell in der Options Form die Möglichkeit bieten.
Um das
shuffleanswers
aus dem Quiz Kontext zu laden, wird imrenderer::formulation_and_controls()
das Quiz abgefragt.Closes #90